import { ref } from "vue";
import { getPaymentInfo } from "@/api/cloud";
import { PaymentInfo } from "@/types/index";

export default function usePaymentInfo() {
  const paymentData = ref<PaymentInfo>({
    cash: 0,
    alipay: 0,
    wechat: 0,
    bankCard: 0,
    pos: 0,
    membership: 0,
  });

  getPaymentInfo().then((res) => {
    const { data } = res;
    if (data.code === 200 && data.result) {
      paymentData.value = data.result;
    }
  });
  return { paymentData };
}
